package com.itheima.shengxiao3;

import java.util.concurrent.ArrayBlockingQueue;

public class Foodie implements Runnable{

    private ArrayBlockingQueue<String> queue;

    public Foodie(ArrayBlockingQueue<String> queue) {
        this.queue = queue;
    }

    @Override
    public void run() {
        while (true){
            try {
                Thread.sleep(100);
                String take = queue.take();
                System.out.println(Thread.currentThread().getName()+"吃货取出了"+take);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }
    }
}
